﻿<!DOCTYPE html>
<html>
<head>
    <title>JS Functions Exercise 4</title>
    <link href="styles/js-console.css" rel="stylesheet" />
</head>
<body>
    <h1>Function to count the number of divs on the web page.</h1>
    <button onclick="execute()">Execute</button>
    <div id="js-console"></div>
    <div>Div 2</div>
    <div>Div 3</div>
    <script src="scripts/js-console.js"></script>
    <script>
        function countDivs()
        {
            var divlist = document.getElementsByTagName("div");

            return divlist.length;
        }

        function execute()
        {
            jsConsole.writeLine("Number is divs is " + countDivs());
        }

    </script>
</body>
</html>
